#include <stdio.h>

int
main(void)
{
	double x, a;
	double result = 0;
	int i = 0;

	scanf("%lf", &x);

	while (scanf("%lf", &a) == 1) {
		if (i > 0)
			result *= x;
		result += a;
		++i;
	}

	printf("%lf\n", result);

	return 0;

}
